<?php

namespace app\common\model;

use think\Model;

class UserFund extends Model
{
    /**
     * 获取某个用户的资金信息
     */
    static function get_fund_by_user_id($user_id)
    {
        $s = new self();
        $data = $s->where('user_id',$user_id)->find();
        return $data;
    }

    /**
     * user_id 改变余额
     */
    static function change_money($user_id,$value)
    {
        $s = new self();
        $fund = $s->where('user_id',$user_id)->find();
        $fund->value = $fund->value + $value;
        $fund->save();
        return $fund;
    }
}
